<template>
  <div>
    <div class="my_amount" v-if="userinfo">
      <div class="my_amount_top">
        <span class="my_title">我的喵币</span>
        <span @click="amountClick">
          <img v-show="show" src="../../../../assets/img/login/icon_open.png" alt="">
          <img v-show="!show" src="../../../../assets/img/login/icon_close.png" alt="">
        </span>
      </div>
      <h4 v-if="!show">******</h4>
      <h4 v-else>
        <span>{{userinfo.ptb}}</span>
        <span class="icon_refresh" @click="refreshClick"></span>
      </h4>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      show: true,
    }
  },
  props: {
    userinfo: {
      type: Object,
      default: null
    },
  },
  methods: {
    amountClick() {
      if (this.show) {
        this.show = false
      }else {
        this.show = true
      }
    },
    refreshClick() {
      this.$emit('refresh-click')
    }
  },
}
</script>

<style lang="less" scoped>
.my_amount {
  position: relative;
  box-sizing: border-box;
  padding: 20px 30px;
  width: 626px;
  height: 140px;
  background: #7974ff;
  border-radius: 20px;
  margin-bottom: 40px;
  color: #fff;
  .my_amount_top {
    display: flex;
    align-items: center;
    height: 34px;
    .my_title {
      line-height: 34px;
      font-size: 28px;
      font-weight: 700;
      padding-right: 15px;
    }
  }
  h4 {
    font-size: 34px;
    font-weight: 700;
    text-shadow: 0px 1px 6px 0px #1a13c8; 
    padding-top: 20px;
    display: flex;
    align-items: center;
  }
}

.my_amount::before {
  content: '';
  position: absolute;
  top: -22px;
  right: -22px;
  width: 138px;
  height: 138px;
  background: url('../../../../assets/img/charge/money.png') no-repeat;
  background-size: 100%;
}

.icon_refresh {
  display: inline-block;
  margin-left: 30px;
  width: 38px;
  height: 38px;
  background: url('../../../../assets/img/withdrawal/icon_refresh.png') no-repeat;
  background-size: 100%;
}
</style>